package org.cbioportal.legacy.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;

@Configuration
public class MethodValidationConfig {

  @Bean
  public MethodValidationPostProcessor methodValidationPostProcessor() {
    MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
    processor.setValidator(validatorFactoryBean());
    return processor;
  }

  @Bean
  public LocalValidatorFactoryBean validatorFactoryBean() {
    return new LocalValidatorFactoryBean();
  }
}
